home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / Developer Documentation / Human Interface / Human Interface Q & A / HI Q&A #4 < prev    next >
Encoding:
Text File  |  1996-04-26  |  9.9 KB  |  246 lines  |  [ttro/ttxt]

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  Q&A #4
  17.  
  18. How to Add Content to OpenDoc
  19.  
  20. By the Apple Computer OpenDoc Human Interface Team
  21.  
  22. As published in the May 1995 Apple Directions .
  23.  
  24. Many OpenDoc demos show how easy it is to add content by dragging a document
  25. from the desktop into an open document. Users like the drag-and-drop feature
  26. better than copying and pasting because they feel more in control, and one
  27. of the goals for OpenDoc is for users to enjoy what they are doing.
  28.  
  29. Recent discussions we've had with developers have shown, however, that we
  30. may have confused you into thinking that dragging and dropping is the only
  31. mechanism for getting new content into an OpenDoc document. So, in this
  32. article we'll describe all the mechanisms that are available: tool palettes,
  33. copy and paste, drag and drop, and the Insert command--from both the user
  34. and developer perspectives.
  35.  
  36. By the end of this article, you'll see how OpenDoc benefits both users and
  37. developers by allowing users to work with all the tools and features with
  38. which they are familiar.
  39.  
  40. Tool Palettes
  41.  
  42. Many of today's applications provide palettes of tools for adding different
  43. kinds of content. Tool palettes are common in painting, drawing, and other
  44. kinds of applications. For example, take a look at the tool palette from
  45. Adobe Persuasion 3.0, as shown on this page. This palette contains various
  46. tools for creating and editing the contents of a drawing--line, rectangle,
  47. and oval tools. It also contains a tool for creating and editing text items.
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. Tool palettes work well for the task of creating new content, and we
  58. encourage developers to continue providing such tools in OpenDoc. However,
  59. we recommend a change in the implementation of these tools. Instead of
  60. reimplementing common function in your code, your OpenDoc software should
  61. use part editors already present on the user's system that perform the same
  62. functions.
  63.  
  64. For example, suppose the user is creating a slide with a hypothetical
  65. version of Persuasion implemented as an OpenDoc presentation part editor.
  66. Here's one way that the presentation part might implement the text tool: The
  67. user chooses the text tool and drags to select a region on the current
  68. slide, as shown in the screen shot "Creating a text part" below. Persuasion
  69. notes the size of the region selected by the user and creates a text part of
  70. the same size within the overall presentation document. The user can then
  71. easily see it and manipulate it.
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  Creating a text part.
  91.  
  92. In the next screen shot, "Using the text part" (below), you'll see that the
  93. user has clicked inside that text part and typed some text. The border
  94. around the text part is the "active border"--it indicates that the text part
  95. is active, and that any keystrokes made will go into this part, which is
  96. controlled by a sample text part editor we've named SurfWriter. It also
  97. indicates that menu commands apply to the content of this part. The menu bar
  98. has changed from slide-specific menus to text-specific menus--and, if you
  99. were to open the Apple menu, you'd find that the first menu command reads
  100. About SurfWriter instead of About Persuasion. Finally, note that the
  101. Persuasion tool palette has gone away because the user is now using the text
  102. part editor, not the gamut of Persuasion tools.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123. Using a text part.
  124.  
  125. The advantage to you is that you can concentrate on the distinguishing
  126. portion of your product, instead of providing yet another implementation of
  127. text editing. You also may be able to simplify your menus. For example, an
  128. OpenDoc implementation of Persuasion would not have a Text menu, because
  129. Persuasion would no longer supply the text functions (see the screen shot
  130. "Creating a text part"). Deleting menus from your product means that it can
  131. provide more features without resorting to hierarchical menus.
  132.  
  133. The advantage to users is that their learning time decreases: They can learn
  134. how to use one editor instead of many, and they're less likely to be
  135. confused by conflicting features of the different implementations of
  136. editors. The text functions have an entire menu bar instead of being
  137. contained in one menu. Thus, the menu structure is simpler and individual
  138. menu items are easier to find than when hidden in hierarchical menus.
  139.  
  140.  
  141.  
  142. Which Editor to Reuse
  143.  
  144. Users may have installed more than one OpenDoc part editor for a particular
  145. kind of content--for example, the latest version and an earlier version of a
  146. particular text editor. Or, users may even have more than one kind of text
  147. editor installed, so that they can exchange files with other users more
  148. easily. OpenDoc allows the user to specify which editor to use for
  149. particular kinds of content. This is done through the Editor Preferences
  150. control panel. So, when your OpenDoc software calls on the features of other
  151. part editors--in our example, a text part editor--make sure that it checks
  152. the user's preferences and uses the part editor listed there.
  153.  
  154. Copy and Paste
  155.  
  156. Copy and Paste is another way to add content to an OpenDoc part. With
  157. today's monolithic applications, a user copies content from one document and
  158. pastes it into another, but the result from the same action in different
  159. contexts is often unpredictable. For example, if the user selects a group of
  160. spreadsheet cells and pastes them into a word processor, the result may be a
  161. table of those numbers, but not the formula. If the user pastes the same
  162. content into a drawing, they're likely to get a text item with tab-delimited
  163. text, but not the formulas. Only part of the content may be copied, and the
  164. pasted content behaves differently from the original. In contrast, when
  165. users copy and paste between OpenDoc documents, they'll get a "smart
  166. paste"--a full function copy of the original, including data, formulas, and
  167. the complete spreadsheet features.
  168.  
  169. The basic rule is that what users copy is what they should have after they
  170. paste. Note, however, that this doesn't mean that every time users paste
  171. they create a new part, with different features, inside the destination
  172. document. When the pasted content belongs to the same kind as the
  173. destination content, the pasted content is merged rather than embedded. For
  174. example, if the user pastes content from a drawing into a second drawing,
  175. the pasted content is merged into the second drawing.
  176.  
  177. Sounds easy, right? But how do you know when to have your OpenDoc software
  178. create a new part and when to have it merge the content into the current
  179. part? Suppose the user pastes content from a painting into a drawing--what
  180. should happen in this case? The user may perceive no difference in the kinds
  181. of content from a simple visual inspection, but because the content is
  182. different the painting is embedded into the drawing instead of merged.
  183.  
  184. Your editor has to determine whether the source and destination content are
  185. compatible. To help your software make this determination, we have defined
  186. several data categories for OpenDoc software--text, painting, drawing,
  187. movie, spreadsheet, controls, and so on.
  188.  
  189. When you develop an OpenDoc part editor, you determine which categories your
  190. editor supports. If the copied content and destination part are in the same
  191. category of data, your editor will then merge the pasted content into the
  192. content of the destination part. Otherwise, your editor will create a new
  193. part, and embed it. (This is described in more detail in the OpenDoc
  194. developer documentation.)
  195.  
  196. Drag and Drop
  197.  
  198. Drag and drop is another way to add content to an OpenDoc part. As with
  199. copying and pasting, dragging and dropping may either cause a new part to be
  200. embedded or content to be merged. However, drag and drop goes a bit further
  201. than today's copy and paste. When the user drags content (for example,
  202. spreadsheet cells) to the desktop, OpenDoc creates a new document. That
  203. document is of the same kind as the source of the dragged content and
  204. contains only the dragged content. This mechanism behaves like the System
  205. 7.5 clippings feature, but the document can be edited, saved, and so on.
  206. (Think of it as "Clippings--The Next Generation.")
  207.  
  208. The Insert Command
  209.  
  210. Like drag and drop, the Insert command is another way to add content to an
  211. OpenDoc part. The differences are that the user doesn't leave the document
  212. to find the content to be added, and only entire documents may be inserted.
  213. The Insert command allows the user to locate the source document using the
  214. Standard File dialog box. When the user chooses a document in the Standard
  215. File dialog box, the contents of that document are inserted at the insertion
  216. point in the active part. As with the copy and paste and the drag and drop
  217. operations, inserted contents may be embedded or merged.
  218.  
  219. Interaction With Non-OpenDoc Documents
  220.  
  221. By now you may be wondering what happens when the user copies content
  222. between OpenDoc and non-OpenDoc documents. OpenDoc allows content to be
  223. copied from non-OpenDoc to OpenDoc documents. When the content is pasted,
  224. dropped, or inserted, OpenDoc determines the user's preferred editor for the
  225. kind of content being inserted. Sometimes translation may occur, and
  226. occasionally there may not be an editor that supports the source kind of
  227. content. Nonetheless, a part of the appropriate kind and content is embedded
  228. so that the content is not lost. The user may later install an additional
  229. editor to handle this kind of content.
  230.  
  231. Going the other way-that is, copying from an OpenDoc document into a
  232. non-OpenDoc document--OpenDoc supports the standard scrap types. However,
  233. embedded content or features not supported by the destination document will
  234. not appear in the destination document--as is the case in today's
  235. applications. (Recall the earlier example, in which cells from a non-OpenDoc
  236. spreadsheet were pasted into a drawing and appeared there as tab-delimited
  237. text without formulas.)
  238.  
  239. Editor's note and disclaimer: The examples in this article should not be
  240. taken as a commitment to any specific future products by Adobe Systems,
  241. Inc., or Apple Computer, Inc. Thanks to Adobe for permission to use
  242. Persuasion in our example.
  243. __________________________________________________________
  244.  
  245. Copyright (c) 1995 by Apple Computer, Inc. All Rights Reserved.
  246.